package com.by.controller.common;

import com.by.common.bean.PageBean;
import com.by.common.bean.ResultBean;
import com.by.condition.common.ProductCondition;
import com.by.controller.BaseController;
import com.by.service.common.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/product")
public class ProductController extends BaseController {

    @Autowired
    ProductService productService;

    @PostMapping("/query")
    public ResultBean query(@RequestBody ProductCondition productCondition){
        PageBean pageBean=productService.queryProduct(productCondition);
        return success("产品列表",pageBean);
    }

    @PostMapping("/query2")
    public ResultBean query2(@RequestBody ProductCondition productCondition){
        PageBean pageBean=productService.queryProductBySql(productCondition);
        return success("产品列表",pageBean);
    }
}
